package cn.xshi.sys.init.spi;

import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.context.event.ApplicationStartedEvent;
import org.springframework.context.ApplicationEvent;
import org.springframework.context.ApplicationListener;
/**
 *
 * SPI 监听
 */
@Slf4j
public class SPIApplicationListener implements ApplicationListener<ApplicationEvent> {

    @Override
    public void onApplicationEvent(ApplicationEvent event) {
        //指定ApplicationEvent事件对应执行的逻辑
        if (event instanceof ApplicationStartedEvent) {
            onApplicationStartedEvent();
        }
    }

    private void onApplicationStartedEvent() {
        log.info("容器启动完执行...");
//        RedisUtil redisUtil = SpringUtils.getBean(RedisUtil.class);
    }
}
